﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Helpers.Conditions;
using MSHTML = mshtml;
using Helpers;

namespace HtmlParsing.Helpers.Conditions
{
    public class AnchorCondition : BaseTagCondition<MSHTML.IHTMLAnchorElement>
    {
        public string Href { get; set; }

        public override bool IsAccepted(mshtml.IHTMLAnchorElement anchor)
        {
            bool result = base.IsAccepted(anchor);

            result &= StringHelper.IsnullOrBlank(Href)
                || (anchor.href != null
                    && anchor.href.ToUpper() == Href.ToUpper());

            return result;
        }
    }
}
